package com.dfrz.problem.service.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.dfrz.problem.dao.EmployeeDao;
import com.dfrz.problem.dao.impl.EmployeeDaoImpl;
import com.dfrz.problem.model.Employee;
import com.dfrz.problem.service.DeleteEmployeeService;
import com.dfrz.problem.utils.IConstant;
import com.dfrz.problem.utils.Result;

public class DeleteEmployeeServiceImpl implements DeleteEmployeeService {
	private static final Logger logger = LoggerFactory.getLogger(EmployeeDaoImpl.class);
	
	private EmployeeDao employeeDao;
	public void setEmployeeDao(EmployeeDao employeeDao) {
		this.employeeDao = employeeDao;
	}
	//public Employee employee;

	@Override
	public Result<Employee> deleteEmployee(String email) {
		
		boolean deleteSuccess  = employeeDao.deleteEmployee(email);

		Result<Employee> result = new Result<Employee>();
		
		if (deleteSuccess) {
			logger.debug("账户{}删除成功！",email);
			result.setCode(IConstant.DELETE_EMPLOYEE_SUCCESS);
		}
		else {
			logger.debug("账户{}删除失败！",email);
			result.setCode(IConstant.DELETE_EMPLOYEE_ERROR);
		}
		
		//result.setResult(employee);
		return result;
	}


}
